<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="m" uri="/cutm_tags"%>
<html>
<head>
<title>添加用户</title>
<script type="text/javascript">
$(document).ready(function() {
	$('#roleForm').vaildAjax(function(data){
		if(data.charAt(0)=='a'){
			$('input[name="role.id"]').val(data.substring(1));
			$('#num').text(data.substring(1));
			BaseJs.alert('添加角色成功');
		}
		if(data.charAt(0)=='u'){
			BaseJs.alert('成功更新角色');
		}
	});
	<s:if test="role==null">
		$('input[name="role.enable"]').radio('true');
	</s:if>
	$('.checkAll').live('click',function(){
		if($(this)[0].checked){
			$($(this)[0].parentNode.parentNode).find('input[name=permiss]:not(checked)').attr('checked',true);
		}else{
			$($(this)[0].parentNode.parentNode).find('input[name=permiss]:checked').attr('checked',false);
		}
	});
});
</script>
<style type="text/css">
.b2b{
	
}
.b2b span{
	display:block;
	width : 100%;
	border-bottom : 1px solid #000;
	background: silver;
}
</style>
</head>
<body>
<h2 class="title"><span>编辑岗位(角色)</span><m:imgA img="add" msg="添加新的角色" action="system/EditRole!toEdit" /></h2>
<s:form id="roleForm" action="system/EditRole">
	<s:hidden name="role.id" />
	<table class="form">
		<tr>
			<th width="15%">角色名称</th>
			<td width="35%"><s:textfield name="role.name" cssClass="rule[required]" maxlength="250" /></td>
			<th width="15%">是否可用</th>
			<td width="35%"><s:radio list="#{true:'可用',false:'禁用'}" name="role.enable" /></td>
		</tr>
		<tr>
			<th>角色描述</th>
			<td colspan="3"><s:textfield cssClass="w96" maxlength="250" name="role.desc" /></td>
		</tr>
		<tr>
			<td colspan="4">请勾选该角色拥有的权限</td>
		</tr>
		<tr>
			<td colspan="4"><s:property value="perstr" escape="false" /></td>
		</tr>
	</table>
	<div class="btnGroup"><s:submit value="提交" /></div>
</s:form>
</body>
</html>